package com.yYclass.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yYclass.enums.DomainTypeEnum;
import com.yYclass.mapper.DomainMapper;
import com.yYclass.model.DomainDO;
import com.yYclass.service.DomainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DomainServiceImpl extends ServiceImpl<DomainMapper, DomainDO> implements DomainService {

    @Autowired
    private DomainMapper domainMapper;

    @Override
    public DomainDO findById(Long id, Long accountNO) {
        return domainMapper.selectOne(new QueryWrapper<DomainDO>().eq("id", id).eq("account_no", accountNO));
    }

    @Override
    public DomainDO findByDomainTypeAndID(Long domainId, DomainTypeEnum domainTypeEnum) {
        return domainMapper.selectOne(new QueryWrapper<DomainDO>().eq("id", domainId).eq("domain_type", domainTypeEnum.name()));
    }
}
